﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxGridView;
using System.Data.SqlClient;
using System.Configuration;

public partial class Teacher_ManageExhibition : System.Web.UI.Page
{
    SqlConnection conn;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Teacher"] == null)
        {
            Response.Redirect("~/Default.aspx");
        }
        else
        {
            string user = Session["Teacher"].ToString();
            if (user[0] == 'T' || user[0] == 't' || user == "Manager" || user == "manager")
            {

            }
            else
            {
                Response.Redirect("~/Default.aspx");
            }
        }
    }

    void AddError(Dictionary<GridViewColumn, string> errors, GridViewColumn column, string errorText)
    {
        if (errors.ContainsKey(column)) return;
        errors[column] = errorText;
    }

    protected void gvwExhibition_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
    {
        //Kiem tra Competition ID ko dc rong
        if (e.NewValues["Exhibition_Details"] == null)
            {
                AddError(e.Errors, gvwExhibition.Columns["Exhibition_Details"], "Competition Details can't be null.");
            }
    }
}